home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Programming / ixemul / include / sys / unix_socket.h < prev    next >
C/C++ Source or Header  |  1997-10-28  |  2KB  |  65 lines

  1. #ifndef _UNIX_SOCKET_H_
  2. #define _UNIX_SOCKET_H_
  3.  
  4. /*
  5.  *  This file is part of ixemul.library for the Amiga.
  6.  *  Copyright (C) 1996 Hans Verkuil
  7.  *
  8.  *  This library is free software; you can redistribute it and/or
  9.  *  modify it under the terms of the GNU Library General Public
  10.  *  License as published by the Free Software Foundation; either
  11.  *  version 2 of the License, or (at your option) any later version.
  12.  *
  13.  *  This library is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  *  Library General Public License for more details.
  17.  *
  18.  *  You should have received a copy of the GNU Library General Public
  19.  *  License along with this library; if not, write to the Free
  20.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23. #define UNIX_SOCKET_SIZE 5120
  24.  
  25. struct sock_stream {
  26.   char  buffer[UNIX_SOCKET_SIZE];
  27.   char  *reader, *writer;
  28.   short flags;
  29.   struct Task *task;
  30. };
  31.  
  32. struct ix_unix_name {
  33.   struct ix_unix_name *next;
  34.   char          path[104];       /* size of struct sockaddr_un.sun_path */
  35.   int           queue_size;
  36.   int           queue_index;
  37.   int           *queue;
  38.   struct Task   *task;
  39. };
  40.  
  41. struct unix_socket {
  42.   char          path[104];       /* size of struct sockaddr_un.sun_path */
  43.   short         state;
  44.   struct sock_stream *from_server;
  45.   struct sock_stream *to_server;
  46.   struct ix_unix_name *unix_name;
  47.   struct file   *server;
  48. };
  49.  
  50. #define UNF_NO_READER    (1<<0)
  51. #define UNF_NO_WRITER    (1<<1)
  52. #define UNF_LOCKED    (1<<2)
  53. #define UNF_WANT_LOCK    (1<<3)
  54.  
  55. /* waiting for accept() */
  56. #define UNS_WAITING     (0)
  57. /* accept() failed */
  58. #define UNS_ERROR       (-1)
  59. /* accept() is processing the request, continue sleeping */
  60. #define UNS_PROCESSING  (1)
  61. /* accept() accepted the request */
  62. #define UNS_ACCEPTED    (2)
  63.  
  64. #endif
  65.